{extend name="light-year/layout/default" /}

{block name="content"}
<div class="card-body">
    <form method="post" action="{:url('indexs/setPassword')}" class="site-form" onsubmit="saveAdminPass( this );return false;">
        <div class="form-group">
            <label>旧密码</label>
            <input type="text" class="form-control" name="old_password" placeholder="输入账号的原登录密码">
        </div>
        <div class="form-group">
            <label>新密码</label>
            <input type="password" class="form-control" name="password" placeholder="输入新的密码">
        </div>
        <div class="form-group">
            <label>确认新密码</label>
            <input type="password" class="form-control" name="password_confirm" placeholder="请再次确认密码">
        </div>
        <button type="submit" class="btn btn-primary">修改密码</button>
    </form>
</div>
{/block}

{block name="script"}
<script>
    function saveAdminPass(_this) {
        axios.post( $(_this).attr('action'), $(_this).serialize()).then(function(data){
            if (data.status == 1){
                layerMsg(data.msg, 1, layerJumpTime, 2);
            }
            else layerMsg(data.msg, 5, layerJumpTime);
        }).catch(function(res){
        });
    }
</script>
{/block}